package com.chinatechstar.admin.job;

import com.chinatechstar.admin.mapper.SysRoleMapper;
import com.chinatechstar.admin.mapper.SysUrlMapper;
import com.chinatechstar.cache.redis.constants.ApplicationConstants;
import com.chinatechstar.cache.redis.util.RedisUtils;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @ClassName:Jobs
 * @功能：
 * @author：wlei
 * @日期：2022/5/31-10:33
 **/

//@Component
public class Jobs {
    @Autowired
    private SysUrlMapper sysUrlMapper;
    @Autowired
    private SysRoleMapper sysRoleMapper;
    @Autowired
    private RedisUtils redisUtils;

    @Scheduled(cron = "0 0 0/1 * * ? ")
    public void execJon() throws InterruptedException {
        // 一小时检查一次redis是否过期
        //System.out.println("检查redis是否过期");
        //List<String> roleCodeList = sysRoleMapper.queryRoleCodeList();
        //for (int i = 0; i < roleCodeList.size(); i++) {
        //    String roleCode = roleCodeList.get(i);
        //    List<String> url = sysUrlMapper.queryRoleUrl(roleCode);
        //    redisUtils.psetex(ApplicationConstants.URL_ROLECODE_PREFIX + roleCode, url == null ? Collections
        //        .emptyList().toString() : url.toString());
        //}
    }

}
